<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo isset($admin_title)?$admin_title:"";?>-<?php echo isset($site_name)?$site_name:"";?></title>
<meta name="author" content="designer:webzhu, date:2012-03-23" />
<link type="image/x-icon" href="<?php echo urldecode(Url::urlFormat("@favicon.ico"));?>" rel="icon">
<link rel="stylesheet" type="text/css" href="<?php echo urldecode(Url::urlFormat("@static/css/base.css"));?>" />
<link rel="stylesheet" type="text/css" href="<?php echo urldecode(Url::urlFormat("@static/css/admin.css"));?>" />
<link rel="stylesheet" type="text/css" href="<?php echo urldecode(Url::urlFormat("@static/css/font_icon.css"));?>" />
<?php echo JS::import('jquery');?>
<script type="text/javascript" src="<?php echo urldecode(Url::urlFormat("@static/js/common.js"));?>"></script>
<!--[if lte IE 7]><script src="<?php echo urldecode(Url::urlFormat("@static/css/fonts/lte-ie7.js"));?>"></script><![endif]-->
</head>
<body >
<div id="header">
	<div class="nav_sub">
			    	您好[<?php echo isset($manager['name'])?$manager['name']:"";?>]&nbsp; | <a href="<?php echo urldecode(Url::urlFormat("/simple/login"));?>" target="_blank">返回前台</a> | <a href="<?php echo urldecode(Url::urlFormat("/admin/logout"));?>">退出</a>&nbsp; | &nbsp; <a id="btn_clear" href="javascript:;">清理缓存</a>
	</div>
    <div id="Logo"><a href=""><img src="<?php echo urldecode(Url::urlFormat("@static/images/logo_min.png"));?>"></a></div>
	<ul id="main_nav" class="clearfix">
	<?php foreach($mainMenu as $key => $item){?>
		<li <?php if($key==$menu_index['menu']){?>class="active"<?php }?>><a href="<?php echo urldecode(Url::urlFormat("$item[link]"));?>"  ><?php echo isset($item['name'])?$item['name']:"";?></a></li>
	<?php }?>
	</ul>
</div>
<div id="mainContent">
	<div id="sidebar" >
		<ul class="menu" style="margin-top:15px;">
		<?php foreach($subMenu as $key => $item){?>
			<li class="submenu">
			<ul><li class="sub-index"><b><a href="javascript:;"><?php echo isset($item['name'])?$item['name']:"";?></a></b></li>
			<?php foreach($menu->getNodes($item['link']) as $key => $item){?>
			<?php if(substr($item['link'],-5)!='_edit' && !$item['hidden'] ){?>
				<li><a href='<?php echo urldecode(Url::urlFormat("$item[link]"));?>' <?php if($item['link']==$nav_link){?>class="current"<?php }?> ><?php echo isset($item['name'])?$item['name']:"";?></a></li>
				<?php }?>
			<?php }?>
			</ul>
			</li>
		<?php }?>
		</ul>
	</div>
	<div id="content" >

		<?php if(!isset($msg)){?><?php $msg=Req::post('msg');?><?php }?>
		<?php if(!isset($validator)){?><?php $validator=Req::post('validator');?><?php }?>
		<?php if(isset($msg[0])){?>
		<div id="message-bar" class="message_<?php echo isset($msg[0])?$msg[0]:"";?>"><?php echo isset($msg[1])?$msg[1]:"";?></div>
		<?php }elseif(isset($validator)){?>
		<div class="message_warning"><?php echo isset($validator['msg'])?$validator['msg']:"";?></div>
		<?php }?>
		<?php echo JS::import('dialog?skin=brief');?>
<?php echo JS::import('dialogtools');?>
<?php echo JS::import('form');?>
<form name="zform" action="" method="post">
    <div class="tools_bar clearfix">
        <!-- <a class="icon-checkbox-checked icon-checkbox-unchecked" href="javascript:;" onclick="tools_select('id[]',this)" title="全选" data="true"> 全选 </a> -->
        <!-- <a  class="icon-remove-2" href="javascript:;" onclick="tools_submit({action:'<?php echo urldecode(Url::urlFormat("/customer/customer_del"));?>',msg:'删除后无法恢复，你真的删除吗？'})" title="删除"> 删除</a> -->
        <!--
        <a href='<?php echo urldecode(Url::urlFormat("/customer/customer_edit"));?>' class="icon-plus" > 添加</a>
        -->
        <a class="icon-delicious" href="<?php echo urldecode(Url::urlFormat("/customer/no_customer_list"));?>"> 全部用户</a>
        <span class="fr"><a href='javascript:;' id="condition" class="icon-search" style=""> 筛选条件</a><input
                id="condition_input" type="hidden" name="condition" value="<?php echo isset($condition)?$condition:"";?>"></span>
    </div>
    <table class="default">
        <tr>

            <!--<th style="width:70px">操作</th>-->
            <th>账号</th>
            <th>姓名</th>
            <!--<th>编码</th>-->
            <th>推荐人</th>
            <th>直推人数</th>
            <!--<th>分红奖</th>-->
            <!--<th>扩展将</th>-->
            <!--<th>助力奖</th>-->
            <th>注册分</th>
            <th>奖金分</th>
            <th>现金分</th>
            <th>购物积分</th>
            <th>重消积分</th>
            <th>资产</th>
            <th>剩余分红积分</th>
            <th style="width:120px">注册时间</th>
            <th>状态</th>
            <th>分红级别</th>
            <th>投资级别</th>
            <th width="150px;">代理地域</th>

        </tr>
        <?php $item=null; $obj = new Query("customer as c,user as u");$obj->where = "c.user_id = u.id and u.status = 0 and $where";$obj->page = "1";$obj->pagesize = "13";$obj->order = "u.id
        desc";$items = $obj->find(); foreach($items as $key => $item){?>
        <tr>

            <!--<td style="width:70px" class="btn_min">-->
                <!--<div class="operat hidden"><a class="icon-cog action" href="javascript:;"> 处理</a>-->
                    <!--<div class="menu_select">-->
                        <!--<ul>-->
                            <!--<li><a class="icon-coin" href="javascript:balance_op(<?php echo isset($item['user_id'])?$item['user_id']:"";?>,2);"> 充值</a></li>-->
                            <!--<li><a class="icon-credit" href="javascript:balance_op(<?php echo isset($item['user_id'])?$item['user_id']:"";?>,4);"> 扣款</a></li>-->

                            <!--<?php if($item['is_seller']==0){?>-->
                            <!--<li><a class="icon-pencil"-->
                                   <!--href="javascript:confirm_action('<?php echo urldecode(Url::urlFormat("/customer/set_seller/id/$item[id]"));?>','确认执行此操作吗？')">设为商家</a>-->
                            <!--</li>-->
                            <!--<?php }?>-->

                            <!--<li><a class="icon-pencil"-->
                                   <!--href="javascript:confirm_action('<?php echo urldecode(Url::urlFormat("/customer/set_u_lx/id/$item[id]/lx/1"));?>','确认执行此操作吗？')">-->
                                <!--开通服务中心</a></li>-->
                            <!--<?php if($item['u_lx']==1){?>-->
                            <!--<li><a class="icon-pencil"-->
                                   <!--href="javascript:confirm_action('<?php echo urldecode(Url::urlFormat("/customer/unset_u_lx/id/$item[id]"));?>','确认执行此操作吗？')">-->
                                <!--取消服务中心</a></li>-->
                            <!--<?php }?>-->
                            <!--<li><a class="icon-pencil"-->
                                   <!--href="javascript:confirm_action('<?php echo urldecode(Url::urlFormat("/customer/set_u_lx/id/$item[id]/lx/2"));?>','确认执行此操作吗？')">-->
                                <!--开通分公司</a></li>-->
                            <!--<?php if($item['u_lx']==2){?>-->
                            <!--<li><a class="icon-pencil"-->
                                   <!--href="javascript:confirm_action('<?php echo urldecode(Url::urlFormat("/customer/unset_u_lx/id/$item[id]"));?>','确认执行此操作吗？')">-->
                                <!--取消分公司</a></li>-->
                            <!--<?php }?>-->
                            <!--<li><a class="icon-pencil red"-->
                                   <!--href="javascript:confirm_action('<?php echo urldecode(Url::urlFormat("/customer/customer_nojj/id/$item[id]"));?>','确认执行此操作吗？')">-->
                                <!--<?php echo $item['nojj']==0?"冻结":"解冻";?></a></li>-->
                            <!--<?php if($item['status']>0){?>-->
                            <!--<li><a class="icon-pencil red"-->
                                   <!--href="javascript:confirm_action('<?php echo urldecode(Url::urlFormat("/customer/customer_clock/id/$item[id]"));?>','确认执行此操作吗？')">-->
                                <!--<?php echo $item['status']==1?"锁定":"解锁";?></a></li>-->
                            <!--<?php }?>-->
                            <!--<?php if($item['status']>0){?>-->
                            <!--&lt;!&ndash;-->
                            <!--<li><a class="icon-pencil red" href="javascript:confirm_action('<?php echo urldecode(Url::urlFormat("/customer/tjr_ok/id/$item[id]"));?>','确认此操作吗？')"> <?php echo $item['tjr_index']==0?"注册选择":"取消注册选择";?></a></li>-->
                            <!--&ndash;&gt;-->
                            <!--<?php }?>-->
                            <!--<li><a class="icon-pencil" href="<?php echo urldecode(Url::urlFormat("/customer/customer_edit/id/$item[id]"));?>"> 编辑</a></li>-->
                            <!--&lt;!&ndash; <li><a class="icon-remove-2" href="javascript:confirm_action('<?php echo urldecode(Url::urlFormat("/customer/customer_del/id/$item[id]"));?>')"> 删除</a></li> &ndash;&gt;-->
                        <!--</ul>-->
                    <!--</div>-->
                <!--</div>-->
            <!--</td>-->
            <td><?php echo isset($item['name'])?$item['name']:"";?>
                <?php if($item['is_seller']==1){?>
                <b style="color:red;">商</b>
                <?php }?>
            </td>
            <td><?php echo isset($item['real_name'])?$item['real_name']:"";?>
            </td>
            <!--<td><?php echo isset($item['number'])?$item['number']:"";?></td>-->
            <td><?php echo Common::getUid($item['tjr_id'])['name'];?></td>
            <td><?php echo isset($item['u_tjrs'])?$item['u_tjrs']:"";?></td>
            <!--<td>-->
            <!--冻结:<?php echo isset($item['dj_xfjf'])?$item['dj_xfjf']:"";?><br>-->
            <!--可用:<?php echo isset($item['ok_xfjf'])?$item['ok_xfjf']:"";?><br>-->
            <!--已释放:<?php echo isset($item['sf_xfjf'])?$item['sf_xfjf']:"";?>-->
            <!--</td>-->
            <td><?php echo isset($item['zcf'])?$item['zcf']:"";?></td>
            <!--<td>-->
            <!--<?php echo isset($item['fhj'])?$item['fhj']:"";?>-->
            <!--</td>-->
            <!--<td>-->
            <!--<?php echo isset($item['kzj'])?$item['kzj']:"";?>-->
            <!--</td>-->
            <!--<td>-->
            <!--<?php echo isset($item['zlj'])?$item['zlj']:"";?>-->
            <!--</td>-->
            <td><?php echo isset($item['jjf'])?$item['jjf']:"";?></td>
            <td><?php echo isset($item['xjf'])?$item['xjf']:"";?></td>
            <td><?php echo isset($item['gwjf'])?$item['gwjf']:"";?></td>
            <td><?php echo isset($item['cxjf'])?$item['cxjf']:"";?></td>
            <td><?php echo isset($item['zc'])?$item['zc']:"";?></td>
            <td><?php echo isset($item['last_fhjf'])?$item['last_fhjf']:"";?></td>
            <td><?php echo isset($item['reg_time'])?$item['reg_time']:"";?></td>
            <td>
                <?php if($item['is_hg']==1){?>
                合格&nbsp;
                <?php }?>
                <?php echo $item['status']==0?"未激活":($item['status']==1?"正常":"锁定");?>&nbsp;&nbsp;<span class='red'><?php echo $item['nojj']==1?"冻结":"";?></span>
            </td>
            <!-- <td style="width:80px"><?php echo isset($grade_name[$item['group_id']])?$grade_name[$item['group_id']]:'默认会员';?></td> -->
            <!--<td>-->
            <!--<?php echo Common::getShenfenname($item['u_lx']);?>-->
            <!--&lt;!&ndash;-->
            <!--<?php echo Common::getShenfenName($item['u_lx']);?>&nbsp;&nbsp;<span class='red'><?php echo Common::getAgentName($item['dl_lx']);?></span>&nbsp;&nbsp;<?php echo $item['lgd_ok']>0?Common::getShenfenName($item['lgd_ok']):"";?>&nbsp;&nbsp;<?php echo $item['gd_ok']>0?Common::getShenfenName($item['gd_ok']):"";?>-->
            <!--&ndash;&gt;-->
            <!--</td>-->
            <td>
                <?php if($item['vip_id'] == 0){?>
                无
                <?php }elseif($item['vip_id'] == 1){?>
                一级代理
                <?php }elseif($item['vip_id'] == 2){?>
                二级代理
                <?php }elseif($item['vip_id'] == 3){?>
                县代理
                <?php }elseif($item['vip_id'] == 4){?>
                市代理
                <?php }?>
            </td>
            <td>
                <?php if($item['group_id'] == 0){?>
                无
                <?php }elseif($item['group_id'] == 1){?>
                一级代理
                <?php }elseif($item['group_id'] == 2){?>
                二级代理
                <?php }elseif($item['group_id'] == 3){?>
                县代理
                <?php }elseif($item['group_id'] == 4){?>
                市代理
                <?php }?>
            </td>
            <td><?php echo Common::area_name($item['dl_area']);?></td>
        </tr>
        <?php }?>
    </table>
</form>
<div class="page_nav">
    <?php echo $obj->pageBar();?>
</div>


<div id="balance_box" style="display: none;width:600px;padding: 5px;" class="box">
    <h2 class="page_title tc" style="border:none" id="balance-title">充值</h2>
    <div class="form2">
        <form id="export_form" action="<?php echo urldecode(Url::urlFormat("/customer/balance_act"));?>" method="post" callback="create_voucher">
            <input type="hidden" id="user_id" name="user_id" value="">
            <input type="hidden" id="type" name="type" value="">
            <dl class="lineD">
                <dt>钱包类型：</dt>
                <dd>
                    <input type="radio" name="account_type" value="1"/>注册分&nbsp;
                    <input type="radio" name="account_type" value="2"/>奖金分&nbsp;
                    <input type="radio" name="account_type" value="3"/>现金分&nbsp;
                    <input type="radio" name="account_type" value="4"/>购物积分&nbsp;
                    <input type="radio" name="account_type" value="5"/>重消积分&nbsp;
                </dd>
                <dt>&nbsp;&nbsp;</dt>
                <!--<dd>-->
                <!--<input type="radio" name="account_type" value="7"/>消费券&nbsp;-->
                <!--<input type="radio" name="account_type" value="5"/>推广额度(总额)&nbsp;-->
                <!--<input type="radio" name="account_type" value="8"/>推广额度(剩余)&nbsp;-->
                <!--<input type="radio" name="account_type" value="9"/>推广额度(已用)-->


                <!--</dd>-->
            </dl>

            <dl class="lineD">
                <dt style="margin-left:-140px;">金额：</dt>
                <dd><input id="amount" pattern="float" min="0.01" name="amount" alt="最少0.01"> <label
                        id="lb_msg"></label></dd>
            </dl>
            <div class="tc mt10">
                <button class="button" id="balance-btn">充值</button>
            </div>
        </form>
    </div>
</div>

<script type="text/javascript">

    //将输入的数字金额转换成对应的中文大写金额
    //idNumber输入的数字金额，idCHN输出的中文大写金额
    function TransformNumberIntoCHN(number) {
        if (!/^(0|[1-9]\d*)(\.\d{1,2})?$/.test(number)) {

            return false;
        }
        var unit = "仟佰拾亿仟佰拾万仟佰拾元角分", str = "";
        number += "00";
        var point = number.indexOf('.');
        if (point >= 0) {
            number = number.substring(0, point) + number.substr(point + 1, 2);
        }
        unit = unit.substr(unit.length - number.length);
        for (var i = 0; i < number.length; i++) {
            str += '零壹贰叁肆伍陆柒捌玖'.charAt(number.charAt(i)) + unit.charAt(i);
        }
        //document.getElementById(idCHN).value = str.replace(/零(仟|佰|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整");
        return str.replace(/零(仟|佰|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整");
    }

    $(function () {
        $("#amount").blur(function () {
            var amount = $("#amount").val();
            if (isNaN(amount) || amount == '') {
                $("#lb_msg").text('');
                return;
            }
            var dxje = TransformNumberIntoCHN(amount);
            $("#lb_msg").text(dxje);
        });
    });


    function balance_op(user_id, type) {
        $("#user_id").val(user_id);
        $("#type").val(type);
        var title = "充值";
        if (type == 4) title = "扣款";
        $("#balance-title").text(title);
        $("#balance-btn").text(title);
        $("#amount").val('');
        art.dialog({
            id: 'balance_op',
            lock: true,
            opacity: 0.1,
            title: title,
            width: 600,
            height: 200,
            padding: "15px",
            content: document.getElementById("balance_box")
        });
    }
    function create_voucher(e) {
        if (e == null) {
            $("#balance-btn").attr("disabled", true);
            var fields = $("#export_form").serializeArray();
            $.get("<?php echo urldecode(Url::urlFormat("/customer/balance_op"));?>", fields, function (data) {
                if (data['status'] == 'success') {
                    art.dialog({id: 'balance_op'}).close();
                    art.dialog.tips("<p class='" + data['status'] + "'>" + data['msg'] + "</p>", 2);
                    setTimeout("tools_reload()", 2000);
                } else {
                    art.dialog.tips("<p class='" + data['status'] + "'>" + data['msg'] + "</p>");
                }
                $("#balance-btn").attr("disabled", false);
            }, 'json');
        }
        return false;
    }
</script>

<script type="text/javascript">
    var form = new Form();
    $("#condition").on("click", function () {
        //$("body").Condition({input:"#condition_input",okVal:'高级搜索',callback:function(data){tools_submit({action:'<?php echo urldecode(Url::urlFormat("/customer/customer_list"));?>',method:'get'});},data:{'name':{name:'账号'},real_name:{name:'姓名'},status:{name:'是否锁定',values:{1:'正常',2:'锁定'}},nojj:{name:'是否冻结',values:{0:'正常',1:'冻结'}},u_lx:{name:'身份',values:{0:'普通',1:'创客',2:'商家'}},mobile:{name:'手机号码'},reg_time:{name:'注册时间'}
        $("body").Condition({
            input: "#condition_input", okVal: '高级搜索', callback: function (data) {
                tools_submit({action: '<?php echo urldecode(Url::urlFormat("/customer/no_customer_list"));?>', method: 'get'});
            }, data: {
                'name': {name: '账号'},
                real_name: {name: '姓名'},
                status: {name: '是否锁定', values: {1: '正常', 2: '锁定'}},
                nojj: {name: '是否冻结', values: {0: '正常', 1: '冻结'}},
//                u_lx: {name: '身份', values: {0: '普通', 1: '服务中心', 2: '分公司'}},
                zcf: {name: '注册分'},
                jjf: {name: '奖金分'},
                xjf: {name: '现金分'},
                gwjf: {name: '购物积分'},
                cxjf: {name: '重消积分'},
                zc: {name: '资产'},
                last_fhjf: {name: '剩余分红积分'},
                reg_time: {name: '注册时间'},
                group_id: {name:'投资级别', values: {1: '一级代理', 2: '二级代理', 3: '县代理',4:'市代理'}}
            }
        });
    });
</script>

	</div>
</div>
<script type="text/javascript">
	$(function () {
		if('<?php echo Req::args("con");?>'=='admin'){
			$(".submenu .current").parent().parent().parent().addClass('current');
		}else{
			$(".submenu").addClass('current');
		}
		$(".submenu .sub-index").on("click",function(){
			$(this).parent().parent().toggleClass('current');
		})
	})

</script>
</body>
</html>
<script>
	$("#btn_clear").on("click",function(){
		$.post("<?php echo urldecode(Url::urlFormat("/admin/clear_act"));?>",function(data){
			art.dialog.tips("<p class='"+data['status']+"'>"+data['msg']+"</p>");
		},'json');
	});
</script>
<!--Powered by TinyRise-->